home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 12
/
012.d81
/
pps #26
< prev
next >
Wrap
Text File
|
2022-08-26
|
3KB
|
117 lines
PEEKs, POKEs, AND SYSes -- Part 26
"ARRAYS"
by Alan Gardner and Jimmy Weiler
======================================
Location: 49-50 Hexadecimal: $31-32
Official label: STREND Type:RAM
Useful BASIC commands: PEEK, POKE
======================================
In our last installment we learned
about simple variables. This month we
tackle subscripted variables, also
known as arrays.
Last time we saw that simple
variables are stored from VARTAB to
ARYTAB (variable table to array table)
and we looked at how each variable was
stored, byte by byte. Arrays are
stored from ARYTAB to STREND (array
table to end of strings). In this
edition of PEEKs, POKEs and SYSes we
will discuss how arrays are laid out.
Let's start with a chart of BASIC
RAM to review what we already know
about variables. Remember that the
pointers named in the left column
RESIDE at addresses from 43 to 55 but
that they POINT TO addresses from 2049
to 40960.
======================================
CHART 1: a review of BASIC RAM
--------------------------------------
Memory,
Pointers &
Pointers' Description
addresses
--------------------------------------
!adr=40960!
!MEMSIZ=55!Highest BASIC RAM address.
! !Strings are stored from
! !here down to FRETOP.
!(strings)!
!FRETOP=51!Top of free variable space.
! !Lowest excursion of string
! !storage. There are no
! !variables between here and
! !STREND. As more strings are
! !used, FRETOP drops toward
! !STREND.
!( empty )!
!STREND=49!End of string space. If
! !string variables push
! !FRETOP down to here,
! !garbage collection happens.
! !When FRETOP overlaps STREND
! !you get an OUT OF MEMORY
! !error.
!(arrays )!
!ARYTAB=47!Array table. Arrays extend
! !up from here to STREND.
!(simple )!
!(var's. )!
!VARTAB=45!Variable table. Simple
! !variables start right above
! !the BASIC program and
!( basic )!extend up to the arrays.
!(program)!
!TXTTAB=43!Text table. BASIC text
!-adr=2048!starts here and extends up
to VARTAB.
======================================
Usually, TXTTAB and MEMSIZ remain
constant. The pointers VARTAB,
ARYTAB, STREND, and FRETOP can contain
addresses for any RAM address
depending on the size of the BASIC
program and what variables it uses.
Enough review. In this installment
we're primarily interested in the
memory from VARTAB to STREND.
-------< continued in Part 27 >-------